package org.yo.router.api.core;

import android.app.Application;
import android.content.res.Configuration;

import androidx.annotation.NonNull;

import org.yo.router.annotation.framework.ApplicationAble;
import org.yo.router.api.launcher.ApplicationAbleManager;

/**
 * @author hailong
 * @date 2021年11月05日 10:08 上午
 * <p>
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 */
public class AbstractComponentApplication extends Application implements ApplicationAble {

    private ApplicationAble mApplicationAble;

    @Override
    public void onCreate() {
        super.onCreate();
        this.onCreate(this);
    }

    @Override
    public void onCreate(Object context) {
        mApplicationAble = ApplicationAbleManager.getInstance();
        mApplicationAble.onCreate(this);
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        mApplicationAble.onLowMemory();
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        mApplicationAble.onTerminate();
    }

    @Override
    public void onConfigurationChanged(@NonNull Object config) {
        super.onConfigurationChanged((Configuration) config);
        mApplicationAble.onConfigurationChanged(config);
    }

}
